﻿@{
    var user = (MODEL.Model.SystemManager)ViewBag.user;
    var menus = (List<MODEL.Model.SystemMenu>)ViewBag.menus;
    var thisPath = (string)ViewData["path"];
}
<nav class="navbar-default navbar-static-side" role="navigation">
    <div class="sidebar-collapse">
        <ul class="nav metismenu" id="side-menu">
            <li class="nav-header">
                <div class="dropdown profile-element">
                    <span style="background:#fff;display:block;height:40px;width:40px;border-radius:20px;text-align:center;line-height:40px;font-size:20px;font-weight:bold" class="manager-name-one">
                        @user.userName.Substring(0, 1)
                    </span>
                    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                        <span class="clear">
                            <span class="block m-t-xs">
                                <strong class="font-bold" id="manager-name">@user.loginName</strong>
                            </span> <span class="text-muted text-xs block">@user.userName</span>
                        </span>
                    </a>
                </div>
                <div class="logo-element">
                    @user.userName.Substring(0, 1)
                </div>
            </li>
            @{
                var home = (thisPath.ToLower().CompareTo("/home/index") == 0) ? "active" : "";
            }
            <li class="@home">
                <a href="/"><i class="fa fa-home"></i> <span class="nav-label">首页</span></a>
            </li>
            @{
                foreach (var item in menus)
                {
                    var actTitle = item.SystemMenuPaths.Where(x => x.path.ToLower() == thisPath.ToLower()).Any() ? "active" : "";
                    <li class="@actTitle">
                        <a href="#">
                            <i class="fa @item.icon"></i><span class="nav-label">@item.name</span><span class="fa arrow"></span>
                        </a>
                        <ul class="nav nav-second-level collapse">
                            @{
                                foreach (var path in item.SystemMenuPaths)
                                {
                                    var act = (@path.path.ToLower() == @thisPath.ToLower()) ? "active" : "";

                                    <li class="@act"><a href="@path.path">@path.name</a></li>
                                }
                            }
                        </ul>
                    </li>
                }
            }
            @{
                var mdypass = (thisPath.ToLower().CompareTo("/home/mdypass") == 0) ? "active" : "";
            }
            <li class="@mdypass">
                <a href="/home/mdypass"><i class="fa fa-lock"></i> <span class="nav-label">修改密码</span></a>
            </li>
        </ul>

    </div>
</nav>
